
/**
 * warningAdmin vuex
 */
import posts from '@/plugins/request'
// import storage from '@/plugins/localStorage'
// initial state
const state = {
  warningAdmin: {
    data: [],
    total: 0
  }
}
// getters
const getters = {
  getWarningAdmin: state => state.warningAdmin,
}
// actions
const actions = {
  async fetchWarningAdminList({commit}, param) {
    let data = await posts.fetchWarningAdminList(param)
    commit('changeWarningAdmin', data)
  },
  async updateWarningAdmin({commit}, formdata) {
    let result = await posts.updateWarningAdmin(formdata)
    return result
  },
  async updateWarningAdminBatch({commit}, formdata) {
    let result = await posts.updateWarningAdminBatch(formdata)
    return result
  },
  async responseWarningAdmin({commit}, data) {
    let result = await posts.responseWarningAdmin(data)
    return result
  },
  async fetchWarningDetail({commit}, data) {
    let result = await posts.fetchWarningDetail(data)
    return result
  }

}

// mutations
const mutations = {
  changeWarningAdmin(state, data) {
    state.warningAdmin.data = data.data
    state.warningAdmin.total = data.total
  }
}
export default {
  state,
  getters,
  actions,
  mutations
}
